//
//  GGMessageCell.swift
//  DongBaoDemo
//
//  Created by 陈志勇 on 2018/8/6.
//  Copyright © 2018年 陈志勇. All rights reserved.
//

import UIKit
import Kingfisher

class GGMessageCell: UITableViewCell {
    
    @IBOutlet weak var member_avatorImageView: UIImageView!
    @IBOutlet weak var member_nameLabel: UILabel!
    @IBOutlet weak var contentLabel: UILabel!
    @IBOutlet weak var score_dataLabel: UILabel!
    @IBOutlet weak var consume_timeLabel: UILabel!
    @IBOutlet weak var message_typeImageView: UIImageView!
    
    @IBOutlet weak var contentInfoBg: UIView!
    // 头像距离左边的约束
    @IBOutlet weak var imageViewCnsL: NSLayoutConstraint!
    // 比分距离右边的约束
    @IBOutlet weak var scoreLabelCnsT: NSLayoutConstraint!
    
    
    var messageVM: MessageViewModel? {
        didSet {
            guard let vm = messageVM else {
                return
            }
            
            member_avatorImageView.kf.setImage(with: vm.member_avatorURL)
            member_nameLabel.text = vm.member_name
            contentLabel.text = vm.content
            score_dataLabel.text = vm.source
            consume_timeLabel.text = vm.midInfo
            message_typeImageView.image = vm.messageTypeImage
            contentInfoBg.isHidden = !vm.isShowDetail
            imageViewCnsL.constant = vm.imageViewCnsL
            scoreLabelCnsT.constant = vm.scoreLabelCnsT
        }
    }
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
}
